package pers.cz.orm.dao.processor;

/**
 * @program: jef-orm
 * @description: 删除操作
 * @author: Cheng Zhi
 * @create: 2023-08-12 15:14
 **/
public class DeleteProcessor extends AbstractDbProcessor {

    @Override
    public DbProcessorEnums getOperEnum() {
        return DbProcessorEnums.DELETE;
    }

    @Override
    public String bindSql() {
        String operType = getOperEnum().getKey();
        StringBuilder sqlBuilder = new StringBuilder();
        sqlBuilder.append(operType);
        sqlBuilder.append(FROM);
        //sqlBuilder.append(getTableName());
        sqlBuilder.append(getWhereClause());
        sqlBuilder.insert(sqlBuilder.indexOf(FROM) + FROM.length(), getTableName());
        return sqlBuilder.toString();
    }
}
